package com.ln.dm1104.demo02;


import java.util.function.Supplier;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/4 15:46
 */
public class Test02 {
    public static void main(String[] args) {
        Teacher teacher = new Teacher("张三", 18);

//        Supplier<String> supplier=()->teacher.getName();
        Supplier<String> supplier=teacher::getName;

        System.out.println(supplier.get());
    }

}
class Teacher{
    private String name;
    private Integer age;

    public Teacher(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
